<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="title">
            <h2><a href="#">Configurações Globais</a></h2>
        </ui:define>

        <ui:define name="body">
            <h:form id="configForm">            
                <p:messages id="messages" closable="true" showDetail="false" autoUpdate="true" />
                <p:panel styleClass="container_24 clearfix">

                    <p:outputLabel value="Projeto Tabularium" styleClass="grid_4" 
                                   for="protocoloSelectBooleanButton" />
                    <p:selectBooleanButton id="protocoloSelectBooleanButton" styleClass="grid_3 selectBooleanButton"
                                           value="#{managerLayout.configuracao.projetoTabularium}" 
                                           onLabel="Sim" offLabel="Não" 
                                           onIcon="ui-icon-check" offIcon="ui-icon-close">
                        <p:ajax update=":configForm:numeroProtocoloLabel, :configForm:numeroProtocoloSelectBooleanButton" 
                                listener="#{managerLayout.display()}"/>
                    </p:selectBooleanButton>

                    <p:outputLabel id="numeroProtocoloLabel" value="Número Automático" styleClass="grid_4" 
                                   style="#{!managerLayout.configuracao.projetoTabularium ? 'display: none' : ''}"
                                   for="numeroProtocoloSelectBooleanButton" />
                    <p:selectBooleanButton id="numeroProtocoloSelectBooleanButton"
                                           style="#{!managerLayout.configuracao.projetoTabularium ? 'display: none' : ''}"
                                           styleClass="grid_3 selectBooleanButton"
                                           value="#{managerLayout.configuracao.gerarNumeroAutomatico}"
                                           onLabel="Sim" offLabel="Não"
                                           onIcon="ui-icon-check" offIcon="ui-icon-close" />
                    <div class="clear" />

                    <p:outputLabel value="Projeto Tabulario" styleClass="grid_4" 
                                   for="obrasSelectBooleanButton" />
                    <p:selectBooleanButton id="obrasSelectBooleanButton"  styleClass="grid_3 selectBooleanButton"
                                           value="#{managerLayout.configuracao.projetoTabulario}"
                                           onLabel="Sim" offLabel="Não"
                                           onIcon="ui-icon-check" offIcon="ui-icon-close" />
                </p:panel>

                <div class="buttonAction">
                    <p:commandButton value="Salvar" icon="ui-icon-disk" update="@form"
                                     actionListener="#{managerLayout.salvarConfiguracoes()}"
                                     styleClass="ui-priority-primary" />
                </div>
            </h:form>

        </ui:define>
    </ui:composition>
</html>
